<template>
	<view class="content">
		<view class="title">意见反馈</view>
		<textarea value="" placeholder="请输入意见反馈..." v-model="content"/>
		<view class="idea" @click="fankui()">提交反馈</view>
	</view>
</template>

<script>
import getdata from '@/common/ajax.js';		
	export default {
		data() {
			return {
				content:''
			}
		},
		methods: {
			fankui(){
				//反馈信息
				var _this = this
				var token = uni.getStorageSync('token')
				var data = {
					content:_this.content
				}
				if(_this.content == ''){
					getdata.shou('提交内容不能为空')
				}else{
					uni.showLoading({
					    title: '提交中'
					});
					uni.request({
						url: getdata.websiteUrl + '/user/message',
						header:{'content-type': "application/x-www-form-urlencoded",token:token},
						dataType: 'json',
						data: {content:_this.content},
						method: 'POST',
						success: res => {
							uni.hideLoading();
							if(res.data.code == 1){
								getdata.shou('提交成功')
								setTimeout(function(){
									uni.navigateBack(); 
								},1500)
							}else if(res.data.code == 401){
								getdata.shou('请登录')
								uni.reLaunch({
								    url: '../login/login'
								});
							}else{
								getdata.shou(res.data.msg)
							}
						},
						fail: res => {
							uni.hideLoading();
							getdata.shou('服务器断开链接')
						}
					});
				}
			},
		}
	}
</script>

<style lang="scss">
.content{
	width: 100%;
	box-sizing: border-box;
	padding:56rpx 40rpx 0;
	.title{
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #000000;
	}
	textarea{
		// box-sizing: border-box;
		margin-top: 40rpx;
		width: 590rpx;
		height: 222rpx;
		background: #F0F0F0;
		padding: 40rpx;
		line-height: 1.5;
		font-size: 24rpx;
		color: #999999;
		border-radius: 10rpx;
	}
	.idea{
		width: 300rpx;
		height: 90rpx;
		line-height: 90rpx;
		background: #1578F2;
		border-radius: 45rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		text-align: center;
		// position: fixed;
		// bottom:150rpx;
		// left:225rpx;
		margin: 200rpx auto;
	}
}

</style>
